#line 1 "D:/Desktop/PSM/coding 877a/test_coding/Test_coding_tnet.c"
char Rx_buff[32];
char New_Flag = 0;
char *Rx_buff_ptr;

void interrupt(){
 char i = 0;
 unsigned timeOut = 0;
 if (PIR1.RCIF) {
 while (timeOut < 20000){
 if (Usart_Data_Ready()){
 Rx_buff[i] = Usart_Read();
 i++;
 Rx_buff[i] = 0;
 timeOut = 0;
 }
 timeOut++;
 }
 New_Flag = 1;
 }
}

void main(){
 TRISB=0b00000011;TRISD=0;
 portb=0;portd=0;

 Lcd_Custom_Config(&PORTD,7,6,5,4,&PORTB,5,4,3);
 Lcd_Custom_Cmd(Lcd_Cursor_Off);
 Lcd_Custom_Cmd(Lcd_Clear);
 Lcd_Custom_Out(1,1,"Test Program");

 Usart_Init(9600);
 INTCON.GIE = 1;
 INTCON.PEIE = 1;
 PIE1.RCIE=1;

 while(1){

 if(New_Flag){
 Lcd_Custom_Cmd(Lcd_Clear);
 New_Flag = 0;
 Rx_buff_ptr = &Rx_buff[0];
 while(*Rx_buff_ptr) {
 Usart_Write(*Rx_buff_ptr);
 Rx_buff_ptr++;
 }
 }lcd_custom_out(2,1,Rx_buff);


 }
}
